package validadores
{
	public class Util
	{
		//Sempre que a data 1 for maior ou igual a data 2 retorna true
		public function comparaDatas(date1:Date, date2:Date):Boolean
		{
			var dia1:String;
			var mes1:String;
			var dia2:String;
			var mes2:String;
			if(date1.date < 10){
				
				dia1 = "0" + date1.date.toString();
				
			}else{
				dia1 = date1.date.toString();
			}
			
			if(date1.month < 10){
				
				mes1 = "0" + date1.month.toString();
				
			}else{
				mes1 = date1.month.toString();
			}						
			
			var dataIni:String = date1.fullYear.toString() + mes1 + dia1;
			var timestamp1:Number = parseInt(dataIni);
			
			if(date2.date < 10){
				
				dia2 = "0" + date2.date.toString();
				
			}else{
				dia2 = date2.date.toString();
			}
			
			if(date2.month < 10){
				
				mes2 = "0" + date2.month.toString();
				
			}else{
				mes2 = date2.month.toString();
			}						
			
			var dataFim:String = date2.fullYear.toString() + mes2 + dia2;
			var timestamp2:Number = parseInt(dataFim);
			if(timestamp1 >= timestamp2){
				return true;
			}else{
				return false;
			}
		}
	}
}